package com.lz.spring.cloud.feign.client;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name="03-spring-eureka-client", fallback = CalcFeignClientFallback.class)
public interface CalcFeignClient {
	
	@RequestMapping(value="/add/{a}/{b}", method=RequestMethod.GET)
	public String add(@PathVariable("a") Integer a, @PathVariable("b") Integer b);
	
}

@Component
class CalcFeignClientFallback implements CalcFeignClient {

	@Override
	public String add(Integer a, Integer b) {
		System.out.println("===进入了addFallback===");
		return "进入了addFallback";
	}
    
}